package com.reggie.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.reggie.pojo.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartDao extends BaseMapper<ShoppingCart> {

    @Delete("delete from shopping_cart where dish_id=#{DishId};")
    int subShoppingCartByDishId(Long DishId);

    @Delete("delete from shopping_cart where setmeal_id=#{SetMealId};")
    int subShoppingCartBySetMealId(Long SetMealId);

    @Select("select * from shopping_cart where user_id = #{id};")
    List<ShoppingCart> selectByUserId(Long id);

    @Delete("delete from shopping_cart where user_id = #{id};")
    int deleteByUserId(Long id);
}
